{-# OPTIONS_GHC
    -XTypeSynonymInstances
    -XMultiParamTypeClasses          #-}
module Types where

import Relational
import Data.Time.Calendar

-- types

newtype Name   = Name String       deriving (Show,Eq,Ord)
newtype Parent = Parent String     deriving (Show,Eq,Ord)
newtype DoB    = DoB Day           deriving (Show,Eq,Ord)
data Gender    = Male | Female     deriving (Show,Eq,Ord)

-- homomorphisms

instance Homomorphism String Name   where χ x = Name x
instance Homomorphism Name String   where χ (Name x) = x
instance Homomorphism String Parent where χ x = Parent x
instance Homomorphism Parent String where χ (Parent x) = x
instance Homomorphism Name Parent   where χ (Name x) = Parent x
instance Homomorphism Parent Name   where χ (Parent x) = Name x
instance Homomorphism Day DoB       where χ x = DoB x
instance Homomorphism DoB Day       where χ (DoB x) = x
